package com.forum.common.event;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 用户提及(@)事件
 */
@Getter
@Setter
@NoArgsConstructor
public class MentionEvent extends MessageEvent {
    
    /**
     * 提及内容（评论或回复的内容）
     */
    private String mentionContent;
    
    /**
     * 帖子标题
     */
    private String postTitle;
    
    /**
     * 构造一个帖子评论中的@提及事件
     * 
     * @param senderId 发送者ID（评论者）
     * @param receiverId 接收者ID（被@的用户）
     * @param postId 帖子ID
     * @param postTitle 帖子标题
     * @param commentId 评论ID
     * @param mentionContent 评论内容
     * @return @提及事件
     */
    public static MentionEvent mentionInComment(Long senderId, Long receiverId, Long postId, String postTitle, 
                                              Long commentId, String mentionContent) {
        MentionEvent event = new MentionEvent();
        event.setType(EventType.USER_MENTION);
        event.setSenderId(senderId);
        event.setReceiverId(receiverId);
        event.setResourceId(commentId);
        event.setMentionContent(mentionContent);
        event.setPostTitle(postTitle);
        event.setContent("有人在帖子《" + postTitle + "》的评论中@了您");
        event.setResourceType("COMMENT");
        event.setLink("/post/detail/" + postId + "#comment-" + commentId);
        return event;
    }
    
    /**
     * 构造一个评论回复中的@提及事件
     * 
     * @param senderId 发送者ID（回复者）
     * @param receiverId 接收者ID（被@的用户）
     * @param postId 帖子ID
     * @param postTitle 帖子标题
     * @param commentId 评论ID
     * @param mentionContent 回复内容
     * @return @提及事件
     */
    public static MentionEvent mentionInReply(Long senderId, Long receiverId, Long postId, String postTitle, 
                                            Long commentId, String mentionContent) {
        MentionEvent event = new MentionEvent();
        event.setType(EventType.USER_MENTION);
        event.setSenderId(senderId);
        event.setReceiverId(receiverId);
        event.setResourceId(commentId);
        event.setMentionContent(mentionContent);
        event.setPostTitle(postTitle);
        event.setContent("有人在帖子《" + postTitle + "》的回复中@了您");
        event.setResourceType("COMMENT");
        event.setLink("/post/detail/" + postId + "#comment-" + commentId);
        return event;
    }
} 